package com.easygo.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.easygo.pojo.Admin;
import com.easygo.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 徐策
 * @date 2020/1/7 15:29
 */
@RestController
@Scope("prototype")
public class AdminController {

    @Autowired
    AdminService adminService;

    //登录方法
    @PostMapping("/adminLogin")
    public Admin AdminLogin(@RequestBody Admin admin){
        return adminService.getOne(new QueryWrapper<Admin>()
                .eq("username",admin.getUsername())
                .eq("password",admin.getPassword())
                .eq("del",0));

    }

}
